package Dict;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        // 初始化一个字典，初始大小为2
        Dict dict = new Dict(2);

        // 插入一些元素
        dict.insert("key1", "value1");
        dict.insert("key2", "value2");
        dict.insert("key3", "value3");
        dict.insert("key4", "value4");
        dict.insert("key5", "value5");

        // 查询元素
        System.out.println("Find key1: " + dict.find("key1"));
        System.out.println("Find key2: " + dict.find("key2"));
        System.out.println("Find key3: " + dict.find("key3"));
        System.out.println("Find key4: " + dict.find("key4"));
        System.out.println("Find key5: " + dict.find("key5"));

        // 获取全部元素
        DictEntry[] allData = dict.getAllData();
        System.out.println("All data:" + Arrays.toString(allData));
        for (DictEntry entry : allData) {
            System.out.println(entry.getKey() + ": " + entry.getValue());
        }
    }
}
